goto is an unstructured control flow statement. It makes code less readable and maintainable. Structured control flow statements such
as if, for, while, continue or break should be used instead.
Noncompliant code example
foo: proc options(main);
declare i fixed decimal init (0);
loopLabel:
put list (i);
i = i + 1;
if i < 10 then go to loopLabel; /* Noncompliant - usage of the GO TO statement */
end;
Compliant solution
foo: proc options(main);
declare i fixed decimal init (0);
do i = 0 to 9; /* Compliant */
put list (i);
end;
end;
Exceptions
Exclusions format parameter can be used to allow specific GO TO targets which match the given regular expression.